#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e5+10;
int a[maxn];
int dp[maxn];
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n;
		scanf("%d",&n);
		int ans = 1;
		for(int i = 1;i<=n;i++)
		{
			dp[i] = 1;
			scanf("%d",&a[i]);
		}
		for(int i = 2;i<=n;i++)
		{
			for(int j = 1;j*j<=i;j++)
			{
				if(i%j==0)
				{
					if(a[i]>a[i/j]) 
						dp[i] = max(dp[i],dp[i/j]+1);
					if(a[i]>a[j]) 
						dp[i] = max(dp[i],dp[j]+1);
				}
			}
		}
		for(int i = 1;i<=n;i++) ans = max(ans,dp[i]);
		printf("**%d\n",ans);
	}
} 
